angular.module('hello', []).controller('lctrl',
		function($rootScope, $scope, $http) {
			var headers = {
				authorization : "Basic " + btoa("hzh302" + ":" + "2235143")
			};
			$scope.login = function() {
				$http.get('/rest/login', {
					headers : headers
				// params : {
				// username : 'hzh302',
				// password : '2235143'
				// }
				}).success(function(data) {
					console.log(data);
				}).error(function() {
					// alert(1);
					console.log(data);
				});
			};

			$scope.logout = function() {
				$http.post('logout',{}).success(function() {
					console.log('logout');
				}).error(function() {
					console.log('logout fail!');
				})
			}

			$scope.hello = function() {
				$http.get('/rest/hello', {}).success(function(data) {
					console.log(data);
				}).error(function() {
					alert("f");
				});
			};
		});